﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProgramsControl.ascx.cs" Inherits="AcademicPlanner.Presentation.Views.Shared.ProgramsControl" %>

<%@ Import Namespace="AcademicPlanner.Framework.Helpers" %>
<%@ Import Namespace="AcademicPlanner.Presentation" %>
<%@ Import Namespace="AcademicPlanner.Presentation.Views.Shared" %>


<% if (!Model.IsSub)
   { %>
	<div class="programs-control yui-skin-sam" id="<%= Model.Id %>">
<% } %>


<div class="programs-list list left-padded">
	<% foreach (var vProgram in Model.Programs)
	{ %>
		<%
			var vReqCourses = new List<string>();
			var vRecmdCourses = new List<string>();
		
			foreach (var vCrse in vProgram.RequiredCourses.ToList())
			{
				vReqCourses.Add(Html.Encode(vCrse.FullName));
			}
			foreach (var vCrse in vProgram.RecommendedCourses.ToList())
			{
				vRecmdCourses.Add(Html.Encode(vCrse.FullName));
			}
		 %>
		<div class="program list-item top-padded bottom-separator" 
				cEditFormUrl="<%= Url.Action("ProgramForm", "Controls", new { pScenario = ProgramFormScenario.EDIT, pProgramId = vProgram.EntityId }) %>" 
				cDeleteUrl="<%= Url.Action("Delete", "Programs", new { pId = vProgram.EntityId }) %>">
			<div class="program-header list-item-header">
				<h3 class="left">
					<%= Html.Encode(vProgram.Name) %>
				</h3>
				<%= WidgetHelper.ActionsContextMenu(Model.Id + "ProgramMenu" + vProgram.EntityId.ToString(), "gProgramsControlCtrl.onProgramMenuClick", ContextMenuActions, ContextMenuIcons)%>
				<%= Html.ClearBreak() %>
			</div>
			<div class="program-body rows-wrapper">
				<div class="row">
					<div class="cell label">
						<%= Html.Label("", Html.Encode(Tr(Labels.Get("MinimumCredits", "Program"))))%>
					</div>
					<div class="cell">
						<%= vProgram.MinimumCredits %>
					</div>
				</div>
				<div class="row">
					<div class="cell label">
						<%= Html.Label("", Html.Encode(Tr(Labels.Get("RequiredCourses", "Program"))))%>
					</div>
					<div class="cell">
						<%= string.Join(", ", vReqCourses.ToArray()) %>
					</div>
				</div>
				<div class="row">
					<div class="cell label">
						<%= Html.Label("", Html.Encode(Tr(Labels.Get("RecommendedCourses", "Program"))))%>
					</div>
					<div class="cell">
						<%= string.Join(", ", vRecmdCourses.ToArray()) %>
					</div>
				</div>
			</div>
		</div>
		<% } %>
</div>
<script type="text/javascript">
	gProgramsControlCtrl.messages.confirmDelete = '<%= SecurityHelper.Escape(Tr("Are you sure you want to delete this program? Dependants will also be deleted!")) %>';
	gDomReadyQueue.push('gProgramsControlCtrl.initList("<%= Model.Id %>");');
</script>


<% if (!Model.IsSub)
   { %>
		</div>
<% } %>